package org.madgecko.basic.model;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class SystemContext {

    private final static  Logger logger = LoggerFactory.getLogger(SystemContext.class);

    private static ThreadLocal<Integer> pageSize = new ThreadLocal<Integer>();
    private static ThreadLocal<Integer> pageOffset = new ThreadLocal<Integer>();
    private static ThreadLocal<String> sort = new ThreadLocal<String>();
    private static ThreadLocal<String> order = new ThreadLocal<String>();
    private static String systemPath;
    private static String webAttachPath;

    public static Integer getPageSize() {
        return pageSize.get();
    }
    public static void setPageSize(Integer _pageSize) {
        pageSize.set(_pageSize);
    }
    public static Integer getPageOffset() {
        return pageOffset.get();
    }
    public static void setPageOffset(Integer _pageOffset) {
        pageOffset.set(_pageOffset);
    }
    public static String getSort() {
        return sort.get();
    }
    public static void setSort(String _sort) {
        sort.set(_sort);
    }
    public static String getOrder() {
        return order.get();
    }
    public static void setOrder(String _order) {
        order.set(_order);
    }
    public static String getSystemPath() {
        return systemPath;
    }
    public static void setSystemPath(String systemPath) {
        //TODO 为什么这里println没有输出呢？
        System.out.println("systemPath" + systemPath);
        System.out.println(systemPath);
        //TODO 为什么这里logger没有输出呢？
        logger.error("systemPath" + systemPath);
        logger.error(systemPath);
        SystemContext.systemPath = systemPath;
    }

    public static String getWebAttachPath() {
        return webAttachPath;
    }

    public static void setWebAttachPath(String webAttachPath) {
        SystemContext.webAttachPath = webAttachPath;
    }

    public static void removePageSize(){
        pageSize.remove();
    }
    public static void removePageOffset(){
        pageOffset.remove();
    }
    public static void removeSort(){
        sort.remove();
    }
    public static void removeOrder(){
        order.remove();
    }
}
